HL7 V2 ADT Process API - Implementation Template
Setup instructions
Please review the pre-requisite setup instructions for setting up Salesforce Health Cloud, Salesforce Connected App, and MuleSoft's HL7 Connector.
Importing Templates into Anypoint Studio
- In Studio, click the Exchange X icon in the upper left of the taskbar.
- Log in with your Anypoint Platform credentials
- Search for the template.
- Click Open.
Running Templates in Anypoint Studio
After you import your template into Studio, follow these configuration steps to run it:
Creating Custom Fields in Salesforce Org Contact Object
These instructions assume an Org was created in Salesforce with access to Contact object.
Click on Salesforce Setup icon and select 'Developer Console' -> It will open a new console window
Go to File -> New -> Apex class and create a new apex class
Copy the code from "/src/test/scripts/MetadataUtility.apxc" to the above apex class and save
Go to Debug -> Open Execute Anonymous Window. Execute the scripts one by one from '/src/test/scripts/CreateCustomField.txt'
The user account being used for the application needs to be configured to use the custom fields. In Setup search for 'Profiles'. Select the profile for the user account. Next click 'Object Settings' and then select 'Contacts'. Finally scroll to 'Field Permissions' section and then ensure the fields set in the scripts have 'Read Access' and 'Edit Access' checked.
Create Code Set and Code Set Bundles and Update in the Configuration Properties
Click on Salesforce App Launcher icon and search "Code Sets" select 'Code Sets'.
- Click New -> Provide "Undefined" value for Name and Code.
- Click on Save.
Click on Salesforce App Launcher icon and search "Code Set Bundles" select 'Code Set Bundles'
- Click New -> Provide "Undefined" value for Name, Code Set 1 select the Code set created in the above step.
- click on save.
Capture the id of above code set and code set bundle and update in the configuration properties (app.codeSet.undefined and app.codeSetBundle.undefined)
Common Configuration
mule.env
- sets the environment where the application is to be deployed. It should be configured inconfig-<mule.env>.yaml
file. For a studio deployment, the recommended mule.env value islocal
.mule.key
- sets the encryption password to be used for encrypting secure properties. Update as needed.
Salesforce Connector Configuration
MuleSoft's Salesforce Connector requires username, password, and optionally a security token to communicate with Salesforce. After obtaining the necessary credentials information configure it in the properties file located in config/properties
folder.
salesforce.username
should be configured in config-<env>.yaml
file.
salesforce.password
should be encrypted and configured in config-secured-<env>.yaml
file.
salesforce.securityToken
should be encrypted and configured in config-secured-<env>.yaml
file.
Please refer to the attached link on how to secure the configuration properties.
Salesforce Composite Connector Configuration
This template uses Salesforce composite connector to perform atomic upserts to multiple Salesforce objects in a single transaction. It requires 'Connected App' in Salesforce.
Please refer to the instructions in Salesforce docs link.
After creating the connected app obtaining the necessary credentials information (Consumer Key and Consumer Secret) configure it in the properties file located in config/properties
folder.
salesforce.username
should be configured in config-<env>.yaml
file.
salesforce.password
should be encrypted and configured in config-secured-<env>.yaml
file.
salesforce.consumerKey
should be configured in config-<env>.yaml
file.
salesforce.consumerSecret
should be encrypted and configured in config-secured-<env>.yaml
file.
salesforce.securityToken
should be encrypted and configured in config-secured-<env>.yaml
file.
Please refer to the attached link on how to secure the configuration properties.
Anypoint MQ FIFO Setup Guide
If you have a requirement to process received messages in the order they were received (e.g. for a given patient), use the following instructions to set up FIFO queues. This will reduce total throughput, so only use FIFO queues if strictly necessary.
- When designing your application, decide on a selector field for defining message groups (typically patient MRN). Although it has no effect for normal queues, it is recommended to set this regardless of whether you are using normal Queues or FIFO Queues, as it will make it much easier to switch to FIFO queues later if it becomes necessary. Specify this variable as the "Message Group ID".
- On the flow with your MQ Subscriber component (or MQ Consumer), specify maxConcurrency as a parameterized property e.g. maxConcurrency="${queue.maxConcurrency}" for later adjustment. On the MQ Subscriber and Publish component, parameterize the queue name e.g. destination="${queue.destination)".
- If using a FIFO queue, set your maxConcurrency property to "1" in your properties file. Otherwise, message ordering will not be properly respected. If using a normal queue, you can set maxConcurrency to a higher value for increased throughput.
- Create a FIFO queue in the Anypoint MQ UI
- Create a client app in the Anypoint MQ UI.
- Adjust the app properties as described above to configure your application to use the new FIFO queue.
- For parallel processing using the FIFO queue, increase the number of workers for the deployed application in Cloudhub. MaxConcurrency cannot be increased beyond 1 for FIFO queues; only single-threaded operation is possible within each worker.
Anypoint MQ Connector Configuration
MuleSoft's Anypoint MQ Connector requires clientId, clientSecret, queueName and url to communicate with Anypoint MQ. After obtaining the necessary credentials information configure it in the properties file located in config/properties
folder.
anypoint-mq.client-id
should be configured in config-<env>.yaml
file.
anypoint-mq.client-secret
should be encrypted and configured in config-secured-<env>.yaml
file.
anypoint-mq.url
should be configured in config-<env>.yaml
file.
anypoint-mq.queueName
should be configured in config-<env>.yaml
file.
Please refer to the attached link on how to secure the configuration properties.
HTTPS Configuration
https.host
— sets the service host interface. It should be configured inconfig-<mule.env>.yaml
file. (Defaults to 0.0.0.0 for all interfaces).https.port
— sets the HTTPS service port number. It should be configured inconfig-<mule.env>.yaml
file. (Default 8082).- TLS Configuration - Keystore properties setup:
keystore.alias
- sets the alias to the keystore. It should be configured inconfig-<mule.env>.yaml
file.keystore.path
- sets the path to the key file. Key should be available in /src/main/resources/keystore. It should be configured inconfig-<mule.env>.yaml
file.keystore.keypass
— sets keystore keypass to support HTTPS operation. It should be encrypted and configured inconfig-secured-<mule.env>.yaml
file.keystore.password
— sets keystore password to support HTTPS operation. It should be encrypted and configured inconfig-secured-<mule.env>.yaml
file.
Please refer to the attached link on how to generate the Keystore.
Run it
- Right-click the template project folder.
- Hover your mouse over Run as.
- Click Mule Application (configure).
- Inside the dialog, select Environment and set the variable mule.env to the appropriate value (e.g dev or local)
- Inside the dialog, select Environment and set the variable mule.key. Click Run.
Deployment instructions for CloudHub using provided scripts
Ensure the Maven profile CloudHub-DEV
has been properly configured in your settings.xml
file. Reference can be found by downloading the Accelerator Setup Guide asset. Additional instructions are available in Accelerator Setup Guide - Configuring the Accelerator Build
section.
Update the config-<env>.yaml
properties appropriately and then use one of the following scripts to deploy the application to CloudHub:
- packageDeploy.sh or deployOnly.sh (Mac/Linux)
- packageDeploy.cmd or deployOnly.cmd (Windows)
Test it
The template accepts requests using HTTPS as well as MLLP listeners:
- Use Advanced Rest Client or Postman to send a request over HTTPS. The template includes a postman collection in the
src/test/resources
folder.adt-a01.hl7
file located insrc/test/resources/HL7InputMessages
. Update the collection variable(s) after successful import. - Use HAPI TestPanel to send a request over MLLP.